﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using LeadExpress.Models.ViewPages;

namespace LeadExpress.Repository
{
    public class SubCategoryManagementRepository : BaseManagementRepository
    {
        LeadExpressEntities entities = new LeadExpressEntities();

        public SubCategoryManagementModel GetModel(string pageType, string roleName)
        {
            SubCategoryManagementModel model = new SubCategoryManagementModel();

            model.HeaderView = GetHeader();
            model.MenuItem = GetMenuItems(roleName, pageType);
            model.ListSubCategory = new Repository.SubCategoryRepository().GetAll();

            return model;
        }

        public SubCategoryManagementModel GetModelAdd(string pageType, string roleName)
        {
            SubCategoryManagementModel model = new SubCategoryManagementModel();

            model.HeaderView = GetHeader();
            model.MenuItem = GetMenuItems(roleName, pageType);
            model.ListCategory = new Repository.CategoryRepository().GetAll();

            return model;
        }

        public SubCategoryManagementModel GetModelEdit(string pageType, string roleName, int id)
        {
            SubCategoryManagementModel model = new SubCategoryManagementModel();

            model.HeaderView = GetHeader();
            model.MenuItem = GetMenuItems(roleName, pageType);
            model.ListCategory = new Repository.CategoryRepository().GetAll();

            if (id > 0)
            {
                model.SubCategoryInfo = new Repository.SubCategoryRepository().GetSingle(id);
            }

            return model;
        }

        public SubCategoryManagementModel GetModelDelete(string pageType, string roleName)
        {
            SubCategoryManagementModel model = new SubCategoryManagementModel();
            model.ListSubCategory = new Repository.SubCategoryRepository().GetAll();

            return model;
        }
    }
}